package com.xiaoai.io.bio4;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * 伪异步通信架构 通过线程池
 * 
 * @Author
 * @Date 2021-09-06 01:02
 */
public class Server {
    public static void main(String[] args){
        System.out.println("=====服务端4启动-伪异步=====");
        try {
            ServerSocket ss = new ServerSocket(9999);

            HandlerSockerServerPool pool = new HandlerSockerServerPool(3,10);
            while (true){
                Socket socket = ss.accept();
                Runnable target = new ServerRunnableTarget(socket);
                pool.execute(target);
            }

        }catch (Exception e){
            e.printStackTrace();
        }    
        
    }
    
}
